{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib as plt\n",
    "\n",
    "%matplotlib inline\n",
    "# set default diplay row count\n",
    "pd.options.display.max_rows=6\n",
    "# pd.options.display.max_columns=6"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Read csv file"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>AA</th>\n",
       "      <th>AAPL</th>\n",
       "      <th>GE</th>\n",
       "      <th>...</th>\n",
       "      <th>PEP</th>\n",
       "      <th>SPX</th>\n",
       "      <th>XOM</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1990-02-01 00:00:00</th>\n",
       "      <td>4.98</td>\n",
       "      <td>7.86</td>\n",
       "      <td>2.87</td>\n",
       "      <td>...</td>\n",
       "      <td>6.04</td>\n",
       "      <td>328.79</td>\n",
       "      <td>6.12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990-02-02 00:00:00</th>\n",
       "      <td>5.04</td>\n",
       "      <td>8.00</td>\n",
       "      <td>2.87</td>\n",
       "      <td>...</td>\n",
       "      <td>6.09</td>\n",
       "      <td>330.92</td>\n",
       "      <td>6.24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990-02-05 00:00:00</th>\n",
       "      <td>5.07</td>\n",
       "      <td>8.18</td>\n",
       "      <td>2.87</td>\n",
       "      <td>...</td>\n",
       "      <td>6.05</td>\n",
       "      <td>331.85</td>\n",
       "      <td>6.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990-02-06 00:00:00</th>\n",
       "      <td>5.01</td>\n",
       "      <td>8.12</td>\n",
       "      <td>2.88</td>\n",
       "      <td>...</td>\n",
       "      <td>6.15</td>\n",
       "      <td>329.66</td>\n",
       "      <td>6.23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990-02-07 00:00:00</th>\n",
       "      <td>5.04</td>\n",
       "      <td>7.77</td>\n",
       "      <td>2.91</td>\n",
       "      <td>...</td>\n",
       "      <td>6.17</td>\n",
       "      <td>333.75</td>\n",
       "      <td>6.33</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                       AA  AAPL    GE  ...    PEP     SPX   XOM\n",
       "1990-02-01 00:00:00  4.98  7.86  2.87  ...   6.04  328.79  6.12\n",
       "1990-02-02 00:00:00  5.04  8.00  2.87  ...   6.09  330.92  6.24\n",
       "1990-02-05 00:00:00  5.07  8.18  2.87  ...   6.05  331.85  6.25\n",
       "1990-02-06 00:00:00  5.01  8.12  2.88  ...   6.15  329.66  6.23\n",
       "1990-02-07 00:00:00  5.04  7.77  2.91  ...   6.17  333.75  6.33\n",
       "\n",
       "[5 rows x 9 columns]"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# using the row-0 as header and the col-0 as rowindex\n",
    "stock1 = pd.read_csv('./pydata-book/examples/stock_px.csv', header=0, index_col=0)\n",
    "stock1.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>AA</th>\n",
       "      <th>AAPL</th>\n",
       "      <th>GE</th>\n",
       "      <th>IBM</th>\n",
       "      <th>JNJ</th>\n",
       "      <th>MSFT</th>\n",
       "      <th>PEP</th>\n",
       "      <th>SPX</th>\n",
       "      <th>XOM</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1990-02-01 00:00:00</th>\n",
       "      <td>2185600.0</td>\n",
       "      <td>4193200.0</td>\n",
       "      <td>14457600.0</td>\n",
       "      <td>6903600.0</td>\n",
       "      <td>5942400.0</td>\n",
       "      <td>89193600.0</td>\n",
       "      <td>2954400.0</td>\n",
       "      <td>154580000.0</td>\n",
       "      <td>2916400.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990-02-02 00:00:00</th>\n",
       "      <td>3103200.0</td>\n",
       "      <td>4248800.0</td>\n",
       "      <td>15302400.0</td>\n",
       "      <td>6064400.0</td>\n",
       "      <td>4732800.0</td>\n",
       "      <td>71395200.0</td>\n",
       "      <td>2424000.0</td>\n",
       "      <td>164400000.0</td>\n",
       "      <td>4250000.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990-02-05 00:00:00</th>\n",
       "      <td>1792800.0</td>\n",
       "      <td>3653200.0</td>\n",
       "      <td>9134400.0</td>\n",
       "      <td>5299200.0</td>\n",
       "      <td>3950400.0</td>\n",
       "      <td>59731200.0</td>\n",
       "      <td>2225400.0</td>\n",
       "      <td>130950000.0</td>\n",
       "      <td>5880800.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990-02-06 00:00:00</th>\n",
       "      <td>2205600.0</td>\n",
       "      <td>2640000.0</td>\n",
       "      <td>14389200.0</td>\n",
       "      <td>10808000.0</td>\n",
       "      <td>3761600.0</td>\n",
       "      <td>81964800.0</td>\n",
       "      <td>3270000.0</td>\n",
       "      <td>134070000.0</td>\n",
       "      <td>4750800.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990-02-07 00:00:00</th>\n",
       "      <td>3592800.0</td>\n",
       "      <td>11180800.0</td>\n",
       "      <td>18704400.0</td>\n",
       "      <td>12057600.0</td>\n",
       "      <td>5458400.0</td>\n",
       "      <td>134150400.0</td>\n",
       "      <td>4332600.0</td>\n",
       "      <td>186710000.0</td>\n",
       "      <td>4124800.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                            AA        AAPL          GE         IBM        JNJ  \\\n",
       "1990-02-01 00:00:00  2185600.0   4193200.0  14457600.0   6903600.0  5942400.0   \n",
       "1990-02-02 00:00:00  3103200.0   4248800.0  15302400.0   6064400.0  4732800.0   \n",
       "1990-02-05 00:00:00  1792800.0   3653200.0   9134400.0   5299200.0  3950400.0   \n",
       "1990-02-06 00:00:00  2205600.0   2640000.0  14389200.0  10808000.0  3761600.0   \n",
       "1990-02-07 00:00:00  3592800.0  11180800.0  18704400.0  12057600.0  5458400.0   \n",
       "\n",
       "                            MSFT        PEP          SPX        XOM  \n",
       "1990-02-01 00:00:00   89193600.0  2954400.0  154580000.0  2916400.0  \n",
       "1990-02-02 00:00:00   71395200.0  2424000.0  164400000.0  4250000.0  \n",
       "1990-02-05 00:00:00   59731200.0  2225400.0  130950000.0  5880800.0  \n",
       "1990-02-06 00:00:00   81964800.0  3270000.0  134070000.0  4750800.0  \n",
       "1990-02-07 00:00:00  134150400.0  4332600.0  186710000.0  4124800.0  "
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "volumn1 = pd.read_csv('./pydata-book/examples/volume.csv', header=0, index_col=0)\n",
    "volumn1.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>AAPL</th>\n",
       "      <th>MSFT</th>\n",
       "      <th>XOM</th>\n",
       "      <th>SPX</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2003-01-02 00:00:00</th>\n",
       "      <td>7.40</td>\n",
       "      <td>21.11</td>\n",
       "      <td>29.22</td>\n",
       "      <td>909.03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2003-01-03 00:00:00</th>\n",
       "      <td>7.45</td>\n",
       "      <td>21.14</td>\n",
       "      <td>29.24</td>\n",
       "      <td>908.59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2003-01-06 00:00:00</th>\n",
       "      <td>7.45</td>\n",
       "      <td>21.52</td>\n",
       "      <td>29.96</td>\n",
       "      <td>929.01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2003-01-07 00:00:00</th>\n",
       "      <td>7.43</td>\n",
       "      <td>21.93</td>\n",
       "      <td>28.95</td>\n",
       "      <td>922.93</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2003-01-08 00:00:00</th>\n",
       "      <td>7.28</td>\n",
       "      <td>21.31</td>\n",
       "      <td>28.83</td>\n",
       "      <td>909.93</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                     AAPL   MSFT    XOM     SPX\n",
       "2003-01-02 00:00:00  7.40  21.11  29.22  909.03\n",
       "2003-01-03 00:00:00  7.45  21.14  29.24  908.59\n",
       "2003-01-06 00:00:00  7.45  21.52  29.96  929.01\n",
       "2003-01-07 00:00:00  7.43  21.93  28.95  922.93\n",
       "2003-01-08 00:00:00  7.28  21.31  28.83  909.93"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stock2 = pd.read_csv('./pydata-book/examples/stock_px_2.csv', header=0, index_col=0)\n",
    "stock2.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Align data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10884288.000000002\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>AA</th>\n",
       "      <th>AAPL</th>\n",
       "      <th>GE</th>\n",
       "      <th>IBM</th>\n",
       "      <th>JNJ</th>\n",
       "      <th>MSFT</th>\n",
       "      <th>PEP</th>\n",
       "      <th>SPX</th>\n",
       "      <th>XOM</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1990-02-01 00:00:00</th>\n",
       "      <td>NaN</td>\n",
       "      <td>32958552.0</td>\n",
       "      <td>41493312.0</td>\n",
       "      <td>115911444.0</td>\n",
       "      <td>25374048.0</td>\n",
       "      <td>45488736.0</td>\n",
       "      <td>17844576.0</td>\n",
       "      <td>5.082436e+10</td>\n",
       "      <td>17848368.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990-02-02 00:00:00</th>\n",
       "      <td>NaN</td>\n",
       "      <td>33990400.0</td>\n",
       "      <td>43917888.0</td>\n",
       "      <td>102427716.0</td>\n",
       "      <td>20682336.0</td>\n",
       "      <td>36411552.0</td>\n",
       "      <td>14762160.0</td>\n",
       "      <td>5.440325e+10</td>\n",
       "      <td>26520000.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990-02-05 00:00:00</th>\n",
       "      <td>NaN</td>\n",
       "      <td>29883176.0</td>\n",
       "      <td>26215728.0</td>\n",
       "      <td>91782144.0</td>\n",
       "      <td>17144736.0</td>\n",
       "      <td>30462912.0</td>\n",
       "      <td>13463670.0</td>\n",
       "      <td>4.345576e+10</td>\n",
       "      <td>36755000.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990-02-06 00:00:00</th>\n",
       "      <td>NaN</td>\n",
       "      <td>21436800.0</td>\n",
       "      <td>41440896.0</td>\n",
       "      <td>189788480.0</td>\n",
       "      <td>16250112.0</td>\n",
       "      <td>41802048.0</td>\n",
       "      <td>20110500.0</td>\n",
       "      <td>4.419752e+10</td>\n",
       "      <td>29597484.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990-02-07 00:00:00</th>\n",
       "      <td>NaN</td>\n",
       "      <td>86874816.0</td>\n",
       "      <td>54429804.0</td>\n",
       "      <td>216192768.0</td>\n",
       "      <td>23907792.0</td>\n",
       "      <td>68416704.0</td>\n",
       "      <td>26732142.0</td>\n",
       "      <td>6.231446e+10</td>\n",
       "      <td>26109984.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                     AA        AAPL          GE          IBM         JNJ  \\\n",
       "1990-02-01 00:00:00 NaN  32958552.0  41493312.0  115911444.0  25374048.0   \n",
       "1990-02-02 00:00:00 NaN  33990400.0  43917888.0  102427716.0  20682336.0   \n",
       "1990-02-05 00:00:00 NaN  29883176.0  26215728.0   91782144.0  17144736.0   \n",
       "1990-02-06 00:00:00 NaN  21436800.0  41440896.0  189788480.0  16250112.0   \n",
       "1990-02-07 00:00:00 NaN  86874816.0  54429804.0  216192768.0  23907792.0   \n",
       "\n",
       "                           MSFT         PEP           SPX         XOM  \n",
       "1990-02-01 00:00:00  45488736.0  17844576.0  5.082436e+10  17848368.0  \n",
       "1990-02-02 00:00:00  36411552.0  14762160.0  5.440325e+10  26520000.0  \n",
       "1990-02-05 00:00:00  30462912.0  13463670.0  4.345576e+10  36755000.0  \n",
       "1990-02-06 00:00:00  41802048.0  20110500.0  4.419752e+10  29597484.0  \n",
       "1990-02-07 00:00:00  68416704.0  26732142.0  6.231446e+10  26109984.0  "
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# remove 'AA' column for align operator below\n",
    "volumn1.drop(['AA'], axis=1, inplace=True)\n",
    "tmp1 = stock1 * volumn1\n",
    "print(2185600.0 * 4.98)\n",
    "tmp1.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>AAPL</th>\n",
       "      <th>GE</th>\n",
       "      <th>IBM</th>\n",
       "      <th>JNJ</th>\n",
       "      <th>MSFT</th>\n",
       "      <th>SPX</th>\n",
       "      <th>XOM</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1990-02-01 00:00:00</th>\n",
       "      <td>3.295855e+07</td>\n",
       "      <td>4.149331e+07</td>\n",
       "      <td>1.159114e+08</td>\n",
       "      <td>25374048.0</td>\n",
       "      <td>4.548874e+07</td>\n",
       "      <td>5.082436e+10</td>\n",
       "      <td>1.784837e+07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990-02-02 00:00:00</th>\n",
       "      <td>3.399040e+07</td>\n",
       "      <td>4.391789e+07</td>\n",
       "      <td>1.024277e+08</td>\n",
       "      <td>20682336.0</td>\n",
       "      <td>3.641155e+07</td>\n",
       "      <td>5.440325e+10</td>\n",
       "      <td>2.652000e+07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990-02-05 00:00:00</th>\n",
       "      <td>2.988318e+07</td>\n",
       "      <td>2.621573e+07</td>\n",
       "      <td>9.178214e+07</td>\n",
       "      <td>17144736.0</td>\n",
       "      <td>3.046291e+07</td>\n",
       "      <td>4.345576e+10</td>\n",
       "      <td>3.675500e+07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2011-10-12 00:00:00</th>\n",
       "      <td>8.931272e+09</td>\n",
       "      <td>1.012784e+09</td>\n",
       "      <td>9.935458e+08</td>\n",
       "      <td>603100183.0</td>\n",
       "      <td>1.415125e+09</td>\n",
       "      <td>6.465258e+12</td>\n",
       "      <td>1.715961e+09</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2011-10-13 00:00:00</th>\n",
       "      <td>6.199110e+09</td>\n",
       "      <td>7.481443e+08</td>\n",
       "      <td>8.218585e+08</td>\n",
       "      <td>499780053.0</td>\n",
       "      <td>1.191123e+09</td>\n",
       "      <td>5.339761e+12</td>\n",
       "      <td>1.492293e+09</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2011-10-14 00:00:00</th>\n",
       "      <td>8.629900e+09</td>\n",
       "      <td>7.492277e+08</td>\n",
       "      <td>1.022803e+09</td>\n",
       "      <td>432251936.0</td>\n",
       "      <td>1.389344e+09</td>\n",
       "      <td>5.041216e+12</td>\n",
       "      <td>1.395873e+09</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5472 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                             AAPL            GE           IBM          JNJ  \\\n",
       "1990-02-01 00:00:00  3.295855e+07  4.149331e+07  1.159114e+08   25374048.0   \n",
       "1990-02-02 00:00:00  3.399040e+07  4.391789e+07  1.024277e+08   20682336.0   \n",
       "1990-02-05 00:00:00  2.988318e+07  2.621573e+07  9.178214e+07   17144736.0   \n",
       "...                           ...           ...           ...          ...   \n",
       "2011-10-12 00:00:00  8.931272e+09  1.012784e+09  9.935458e+08  603100183.0   \n",
       "2011-10-13 00:00:00  6.199110e+09  7.481443e+08  8.218585e+08  499780053.0   \n",
       "2011-10-14 00:00:00  8.629900e+09  7.492277e+08  1.022803e+09  432251936.0   \n",
       "\n",
       "                             MSFT           SPX           XOM  \n",
       "1990-02-01 00:00:00  4.548874e+07  5.082436e+10  1.784837e+07  \n",
       "1990-02-02 00:00:00  3.641155e+07  5.440325e+10  2.652000e+07  \n",
       "1990-02-05 00:00:00  3.046291e+07  4.345576e+10  3.675500e+07  \n",
       "...                           ...           ...           ...  \n",
       "2011-10-12 00:00:00  1.415125e+09  6.465258e+12  1.715961e+09  \n",
       "2011-10-13 00:00:00  1.191123e+09  5.339761e+12  1.492293e+09  \n",
       "2011-10-14 00:00:00  1.389344e+09  5.041216e+12  1.395873e+09  \n",
       "\n",
       "[5472 rows x 7 columns]"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# remove nan clolums\n",
    "tmp1.dropna(axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(                        AA    AAPL     GE  ...      PEP      SPX    XOM\n",
       " 1990-02-01 00:00:00   4.98    7.86   2.87  ...     6.04   328.79   6.12\n",
       " 1990-02-02 00:00:00   5.04    8.00   2.87  ...     6.09   330.92   6.24\n",
       " 1990-02-05 00:00:00   5.07    8.18   2.87  ...     6.05   331.85   6.25\n",
       " ...                    ...     ...    ...  ...      ...      ...    ...\n",
       " 2011-10-12 00:00:00  10.05  402.19  16.40  ...    62.70  1207.25  77.16\n",
       " 2011-10-13 00:00:00  10.10  408.43  16.22  ...    62.36  1203.66  76.37\n",
       " 2011-10-14 00:00:00  10.26  422.00  16.60  ...    62.24  1224.58  78.11\n",
       " \n",
       " [5472 rows x 9 columns],\n",
       "                      AA        AAPL          GE     ...             PEP  \\\n",
       " 1990-02-01 00:00:00 NaN   4193200.0  14457600.0     ...       2954400.0   \n",
       " 1990-02-02 00:00:00 NaN   4248800.0  15302400.0     ...       2424000.0   \n",
       " 1990-02-05 00:00:00 NaN   3653200.0   9134400.0     ...       2225400.0   \n",
       " ...                  ..         ...         ...     ...             ...   \n",
       " 2011-10-12 00:00:00 NaN  22206600.0  61755100.0     ...      13796200.0   \n",
       " 2011-10-13 00:00:00 NaN  15177900.0  46124800.0     ...       6887300.0   \n",
       " 2011-10-14 00:00:00 NaN  20450000.0  45134200.0     ...       8736600.0   \n",
       " \n",
       "                               SPX         XOM  \n",
       " 1990-02-01 00:00:00  1.545800e+08   2916400.0  \n",
       " 1990-02-02 00:00:00  1.644000e+08   4250000.0  \n",
       " 1990-02-05 00:00:00  1.309500e+08   5880800.0  \n",
       " ...                           ...         ...  \n",
       " 2011-10-12 00:00:00  5.355360e+09  22239000.0  \n",
       " 2011-10-13 00:00:00  4.436270e+09  19540300.0  \n",
       " 2011-10-14 00:00:00  4.116690e+09  17870600.0  \n",
       " \n",
       " [5472 rows x 9 columns])"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# manualy align data\n",
    "tmp2 = stock1.align(other=volumn1, join='outer')\n",
    "tmp2"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.4.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
